<template>
  <ShopForm titles="门店修改" :data="shopData" @handle="set"></ShopForm>
</template>

<script>
import ShopForm from "../../components/ShopManage/shopForm.vue";
import axios from "axios";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
  "ShopManage"
);
export default {
  components: {
    ShopForm
  },
  mounted() {
    this.render();
  },
  data() {
    return {
      shopData: {
        name: "", // 名称
        address: "", // 地址
        telephone: "", // 电话
        desc: "" // 门店描述
      }
    };
  },
  methods: {
    ...mapActions(["setShop"]),
    async render() {
      console.log(this.$route.params.data,1111111111)
      axios
        .post("/api/shopManage/find", { _id: this.$route.params.data })
        .then(res => {
          console.log(res.data,222222222222)
          this.shopData = res.data[0];
        });
    },
    set(data) {
      this.setShop({ condition: { _id: this.$route.params.data }, data });
      this.$router.push("/system/shopManage");
    }
  }
};
</script>

<style>
</style>